import abc
import numpy as np


class Formation(abc.ABC):

    def __init__(self, delta: float, count: int) -> None:
        super().__init__()
        self._delta = delta
        self._count = count

    def cal_deltas(self, psi: float):
        deltas = [np.zeros((3, self._count)) for _ in range(self._count)]
        deltas[0] = self.cal_delta0(psi)
        for i in range(1, self._count):
            for j in range(self._count):
                if j < i:
                    deltas[i][:, j] = -deltas[j][:, i]
                elif j > i:
                    deltas[i][:, j] = deltas[i - 1][:, j] + deltas[i][:, i - 1]

        return deltas

    @abc.abstractmethod
    def cal_delta0(self, psi: float) -> np.ndarray:
        pass
